package cn.iocoder.yudao.module.promotion.dal.mysql.rankingrecord;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.promotion.dal.dataobject.rankingrecord.RankingRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.promotion.controller.admin.rankingrecord.vo.*;

/**
 * 排行榜分佣记录 Mapper
 *
 * @author 万民匠心
 */
@Mapper
public interface RankingRecordMapper extends BaseMapperX<RankingRecordDO> {

    default PageResult<RankingRecordDO> selectPage(RankingRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RankingRecordDO>()
                .eqIfPresent(RankingRecordDO::getRankingId, reqVO.getRankingId())
                .eqIfPresent(RankingRecordDO::getBrokerageUserId, reqVO.getBrokerageUserId())
                .eqIfPresent(RankingRecordDO::getBizId, reqVO.getBizId())
                .eqIfPresent(RankingRecordDO::getBizType, reqVO.getBizType())
                .eqIfPresent(RankingRecordDO::getTitle, reqVO.getTitle())
                .eqIfPresent(RankingRecordDO::getPrice, reqVO.getPrice())
                .eqIfPresent(RankingRecordDO::getScore, reqVO.getScore())
                .eqIfPresent(RankingRecordDO::getDescription, reqVO.getDescription())
                .eqIfPresent(RankingRecordDO::getStatus, reqVO.getStatus())
                .eqIfPresent(RankingRecordDO::getSourceUserLevel, reqVO.getSourceUserLevel())
                .eqIfPresent(RankingRecordDO::getSourceUserId, reqVO.getSourceUserId())
                .betweenIfPresent(RankingRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RankingRecordDO::getId));
    }

}